import {
    Row,
    Col,
    Form,
    Input,
    Modal,
} from 'antd';

const FormItem = Form.Item;


//新增表单
const CreateForm = Form.create()(props => {
    const { modalVisible, form, handleAdd, handleModalVisible } = props;
const okHandle = () => {
    form.validateFields((err, fieldsValue) => {
        if (err) return;
    form.resetFields();
    handleAdd(fieldsValue);
});
};
return (
    <Modal
width={800}
height={800}
destroyOnClose
title="新增"
visible={modalVisible}
onOk={okHandle}
onCancel={() => handleModalVisible()}
>
<Form  layout="vertical">

    <Row gutter={{ md: 8, lg: 24, xl: 48 }}>


        <Col  md={12} sm={24}>
		        <FormItem  label="系统名称">
		            {form.getFieldDecorator('name', {
		            rules: [{ required: true, message: '请输入系统名称！', min: 1 }],
		            })(<Input placeholder="请输入" />)}
		        </FormItem>
        </Col>


        <Col  md={12} sm={24}>
		        <FormItem  label="英文名称">
		            {form.getFieldDecorator('ename', {
		            rules: [{ required: false, message: '请输入英文名称！', min: 1 }],
		            })(<Input placeholder="请输入" />)}
		        </FormItem>
        </Col>


    </Row>
    <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
        <Col  md={12} sm={24}>
                <FormItem  label="上下文">
                    {form.getFieldDecorator('contextpath', {
                    rules: [{ required: true, message: '请输入上下文！', min: 1 }],
                    })(<Input placeholder="请输入" />)}
                </FormItem>
        </Col>
        <Col  md={12} sm={24}>
                <FormItem  label="表名前缀">
                    {form.getFieldDecorator('tableprefix', {
                    rules: [{ required: true, message: '请输入表名前缀！', min: 1 }],
                    })(<Input placeholder="请输入" />)}
                </FormItem>
        </Col>

    </Row>
    <Row gutter={{ md: 8, lg: 24, xl: 48 }}>
        <Col  md={12} sm={24}>
                <FormItem  label="状态">
                    {form.getFieldDecorator('status', {
                    rules: [{ required: true, message: '请输入状态！', min: 1 }],
                    })(<Input placeholder="请输入" />)}
                </FormItem>
        </Col>
      

    </Row>

</Form>
</Modal>
);
});

export default CreateForm;